Imports Microsoft.VisualBasic
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Imports System.Data
Imports DataAccesGenerales
Imports DataAcces

Public Class DataAccesSolMultiple
  Private Const consTimeOut As Integer = 0 

    ''' <summary>
    ''' Funcion para Insertar un regristro en la tabla SolMultiple
    ''' </summary>
   Public Function SolMultiple_InsertarModificar(pniddocumento As Long, ptipo_maniobra As String, pestado As String, particulo As Long, pfecha_solicitud As String, ppuerto_destino As Long, ppuerto_descarga As Long, pbuque As Long, ppatente As String, prectificado As String, pfolio_entrada As Long, pfolio_programacion As Long, pfecha_entrada As String, pfecha_rectificacion As String, pfecha_programacion As String, pfeta As String, pidrecinto_desde As Long, pidrecinto_hasta As Long, pvid As Long, pid_mcia As String, ppedimento As String, pregimen As String, pbooking As String, pregistro As String, pconso_desconso As String, pdc_emp_aduanal As String, pemp_aduanal As String, pcliente As String, prfc As String, pdireccion As String, pciudad As String, pcp As String, plinea_trans As String, pchofer As String, pplacas As String, pno_economico As String, pno_licencia As String, pfecha_actualizacion As String, prfc_responsable As String, pnombre_responsable As String, prepresentante As String, pprocesado_sip As Long, pprogramado_calt As Long, prfc_transportista As String) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleInsertarModificar"
          oraCommandDocumentos.Parameters.Add("pniddocumento", pniddocumento)
          oraCommandDocumentos.Parameters.Add("ptipo_maniobra", ptipo_maniobra)
          oraCommandDocumentos.Parameters.Add("pestado", pestado)
          oraCommandDocumentos.Parameters.Add("particulo", particulo)
          oraCommandDocumentos.Parameters.Add("pfecha_solicitud", pfecha_solicitud)
          oraCommandDocumentos.Parameters.Add("ppuerto_destino", ppuerto_destino)
          oraCommandDocumentos.Parameters.Add("ppuerto_descarga", ppuerto_descarga)
          oraCommandDocumentos.Parameters.Add("pbuque", pbuque)
          oraCommandDocumentos.Parameters.Add("ppatente", ppatente)
          oraCommandDocumentos.Parameters.Add("prectificado", prectificado)
          oraCommandDocumentos.Parameters.Add("pfolio_entrada", pfolio_entrada)
          oraCommandDocumentos.Parameters.Add("pfolio_programacion", pfolio_programacion)
          oraCommandDocumentos.Parameters.Add("pfecha_entrada", pfecha_entrada)
          oraCommandDocumentos.Parameters.Add("pfecha_rectificacion", pfecha_rectificacion)
          oraCommandDocumentos.Parameters.Add("pfecha_programacion", pfecha_programacion)
          oraCommandDocumentos.Parameters.Add("pfeta", pfeta)
          oraCommandDocumentos.Parameters.Add("pidrecinto_desde", pidrecinto_desde)
          oraCommandDocumentos.Parameters.Add("pidrecinto_hasta", pidrecinto_hasta)
          oraCommandDocumentos.Parameters.Add("pvid", pvid)
          oraCommandDocumentos.Parameters.Add("pid_mcia", pid_mcia)
          oraCommandDocumentos.Parameters.Add("ppedimento", ppedimento)
          oraCommandDocumentos.Parameters.Add("pregimen", pregimen)
          oraCommandDocumentos.Parameters.Add("pbooking", pbooking)
          oraCommandDocumentos.Parameters.Add("pregistro", pregistro)
          oraCommandDocumentos.Parameters.Add("pconso_desconso", pconso_desconso)
          oraCommandDocumentos.Parameters.Add("pdc_emp_aduanal", pdc_emp_aduanal)
          oraCommandDocumentos.Parameters.Add("pemp_aduanal", pemp_aduanal)
          oraCommandDocumentos.Parameters.Add("pcliente", pcliente)
          oraCommandDocumentos.Parameters.Add("prfc", prfc)
          oraCommandDocumentos.Parameters.Add("pdireccion", pdireccion)
          oraCommandDocumentos.Parameters.Add("pciudad", pciudad)
          oraCommandDocumentos.Parameters.Add("pcp", pcp)
          oraCommandDocumentos.Parameters.Add("plinea_trans", plinea_trans)
          oraCommandDocumentos.Parameters.Add("pchofer", pchofer)
          oraCommandDocumentos.Parameters.Add("pplacas", pplacas)
          oraCommandDocumentos.Parameters.Add("pno_economico", pno_economico)
          oraCommandDocumentos.Parameters.Add("pno_licencia", pno_licencia)
          oraCommandDocumentos.Parameters.Add("pfecha_actualizacion", pfecha_actualizacion)
          oraCommandDocumentos.Parameters.Add("prfc_responsable", prfc_responsable)
          oraCommandDocumentos.Parameters.Add("pnombre_responsable", pnombre_responsable)
          oraCommandDocumentos.Parameters.Add("prepresentante", prepresentante)
          oraCommandDocumentos.Parameters.Add("pprocesado_sip", pprocesado_sip)
          oraCommandDocumentos.Parameters.Add("pprogramado_calt", pprogramado_calt)
          oraCommandDocumentos.Parameters.Add("prfc_transportista", prfc_transportista)

                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
    ''' <summary>
    ''' Funcion para consultar un registro de la tabla SolMultiple
    ''' </summary>
    ''' <param name="pNidDocumento">numero de documento</param>
    ''' <returns>DataTable</returns>
    ''' <remarks></remarks>
   Public Function SolMultiple_Consultar(pNidDocumento As Long) As DataTable
        Dim dtResultado As New DataTable("SolMultipleConsulta")
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleConsultar"
                    oraCommandDocumentos.Parameters.Add("pNidDocumento", pNidDocumento)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pCursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    oraDataAdapter.Fill(dtResultado)
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dtResultado
    End Function
  
    ''' <summary>
    ''' Funcion para generar la cadena XML Chilkat del documento de la tabla SolMultiple
    ''' </summary>
    ''' <param name="nidDocumento"> numero del documento</param>
    ''' <returns>Chilkat.Xml</returns>
    ''' <remarks></remarks>
   Public Function SolMultiple_CadenaOriginalXMLChilkat(nidDocumento As Long) As Chilkat.Xml
        Dim detalleDataSet As New DataSet("DatosSolMultiple")
        Try
      detalleDataSet = SolMultiple_DetalleXML(nidDocumento)
            'En esta parte van las tablas obtenidas en la consulta anterior
            'separadas dependiendo del reporte a crear, ejemplo:
            detalleDataSet.Tables(0).TableName = "Informacion del Tramite"
            detalleDataSet.Tables(1).TableName = "Datos SolMultiple"
            detalleDataSet.Tables(2).TableName = "Archivos Anexos"
            detalleDataSet.Tables(3).TableName = "Incidencias"

            Dim xml As New Chilkat.Xml
            xml.LoadXml(detalleDataSet.GetXml())
            Return xml 'detalleDataSet.GetXml()
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    ''' <summary>
    ''' Funcion para consultar el detalle del documento de la tabla SolMultiple
    ''' </summary>
    ''' <param name="pNidDocumento">numero del documento</param>
    ''' <returns>DataSet</returns>
    ''' <remarks></remarks>
   Public Function SolMultiple_DetalleXML(pNidDocumento As Long) As DataSet
        Dim dsDetalle As New DataSet("SolMultipleDetalle")
        Dim pTransaccion As Byte = 0
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleDetalleXML"
                    oraCommandDocumentos.Parameters.Add("pNidDocumento", pNidDocumento)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    'En esta parte es para los cursores necesario 
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pEncabezado", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pDatos", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pAnexos", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pIncidencias", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    'pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    oraDataAdapter.Fill(dsDetalle)
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dsDetalle
    End Function
  
   Public Function SolMultiple_DatosBase() As DataTable
        Dim dtResultado As New DataTable("SolMultipleConsulta")
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleDatosBase"
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pCursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    oraDataAdapter.Fill(dtResultado)
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dtResultado
    End Function
  
    ''' <summary>
    ''' Funcion para Insertar un regristro en la tabla SolMultiple
    ''' </summary>
   Public Function SolMultiple_Insertar(pniddocumento As Long, ptipo_maniobra As String, pestado As String, particulo As Long, pfecha_solicitud As String, ppuerto_destino As Long, ppuerto_descarga As Long, pbuque As Long, ppatente As String, prectificado As String, pfolio_entrada As Long, pfolio_programacion As Long, pfecha_entrada As String, pfecha_rectificacion As String, pfecha_programacion As String, pfeta As String, pidrecinto_desde As Long, pidrecinto_hasta As Long, pvid As Long, pid_mcia As String, ppedimento As String, pregimen As String, pbooking As String, pregistro As String, pconso_desconso As String, pdc_emp_aduanal As String, pemp_aduanal As String, pcliente As String, prfc As String, pdireccion As String, pciudad As String, pcp As String, plinea_trans As String, pchofer As String, pplacas As String, pno_economico As String, pno_licencia As String, pfecha_actualizacion As String, prfc_responsable As String, pnombre_responsable As String, prepresentante As String, pprocesado_sip As Long, pprogramado_calt As Long, prfc_transportista As String) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleInsertar"
          oraCommandDocumentos.Parameters.Add("pniddocumento", pniddocumento)
          oraCommandDocumentos.Parameters.Add("ptipo_maniobra", ptipo_maniobra)
          oraCommandDocumentos.Parameters.Add("pestado", pestado)
          oraCommandDocumentos.Parameters.Add("particulo", particulo)
          oraCommandDocumentos.Parameters.Add("pfecha_solicitud", pfecha_solicitud)
          oraCommandDocumentos.Parameters.Add("ppuerto_destino", ppuerto_destino)
          oraCommandDocumentos.Parameters.Add("ppuerto_descarga", ppuerto_descarga)
          oraCommandDocumentos.Parameters.Add("pbuque", pbuque)
          oraCommandDocumentos.Parameters.Add("ppatente", ppatente)
          oraCommandDocumentos.Parameters.Add("prectificado", prectificado)
          oraCommandDocumentos.Parameters.Add("pfolio_entrada", pfolio_entrada)
          oraCommandDocumentos.Parameters.Add("pfolio_programacion", pfolio_programacion)
          oraCommandDocumentos.Parameters.Add("pfecha_entrada", pfecha_entrada)
          oraCommandDocumentos.Parameters.Add("pfecha_rectificacion", pfecha_rectificacion)
          oraCommandDocumentos.Parameters.Add("pfecha_programacion", pfecha_programacion)
          oraCommandDocumentos.Parameters.Add("pfeta", pfeta)
          oraCommandDocumentos.Parameters.Add("pidrecinto_desde", pidrecinto_desde)
          oraCommandDocumentos.Parameters.Add("pidrecinto_hasta", pidrecinto_hasta)
          oraCommandDocumentos.Parameters.Add("pvid", pvid)
          oraCommandDocumentos.Parameters.Add("pid_mcia", pid_mcia)
          oraCommandDocumentos.Parameters.Add("ppedimento", ppedimento)
          oraCommandDocumentos.Parameters.Add("pregimen", pregimen)
          oraCommandDocumentos.Parameters.Add("pbooking", pbooking)
          oraCommandDocumentos.Parameters.Add("pregistro", pregistro)
          oraCommandDocumentos.Parameters.Add("pconso_desconso", pconso_desconso)
          oraCommandDocumentos.Parameters.Add("pdc_emp_aduanal", pdc_emp_aduanal)
          oraCommandDocumentos.Parameters.Add("pemp_aduanal", pemp_aduanal)
          oraCommandDocumentos.Parameters.Add("pcliente", pcliente)
          oraCommandDocumentos.Parameters.Add("prfc", prfc)
          oraCommandDocumentos.Parameters.Add("pdireccion", pdireccion)
          oraCommandDocumentos.Parameters.Add("pciudad", pciudad)
          oraCommandDocumentos.Parameters.Add("pcp", pcp)
          oraCommandDocumentos.Parameters.Add("plinea_trans", plinea_trans)
          oraCommandDocumentos.Parameters.Add("pchofer", pchofer)
          oraCommandDocumentos.Parameters.Add("pplacas", pplacas)
          oraCommandDocumentos.Parameters.Add("pno_economico", pno_economico)
          oraCommandDocumentos.Parameters.Add("pno_licencia", pno_licencia)
          oraCommandDocumentos.Parameters.Add("pfecha_actualizacion", pfecha_actualizacion)
          oraCommandDocumentos.Parameters.Add("prfc_responsable", prfc_responsable)
          oraCommandDocumentos.Parameters.Add("pnombre_responsable", pnombre_responsable)
          oraCommandDocumentos.Parameters.Add("prepresentante", prepresentante)
          oraCommandDocumentos.Parameters.Add("pprocesado_sip", pprocesado_sip)
          oraCommandDocumentos.Parameters.Add("pprogramado_calt", pprogramado_calt)
          oraCommandDocumentos.Parameters.Add("prfc_transportista", prfc_transportista)

                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function

    ''' <summary>
    ''' Funcion para Modificar un regristro en la tabla SolMultiple
    ''' </summary>
   Public Function SolMultiple_Modificar(pniddocumento As Long, ptipo_maniobra As String, pestado As String, particulo As Long, pfecha_solicitud As String, ppuerto_destino As Long, ppuerto_descarga As Long, pbuque As Long, ppatente As String, prectificado As String, pfolio_entrada As Long, pfolio_programacion As Long, pfecha_entrada As String, pfecha_rectificacion As String, pfecha_programacion As String, pfeta As String, pidrecinto_desde As Long, pidrecinto_hasta As Long, pvid As Long, pid_mcia As String, ppedimento As String, pregimen As String, pbooking As String, pregistro As String, pconso_desconso As String, pdc_emp_aduanal As String, pemp_aduanal As String, pcliente As String, prfc As String, pdireccion As String, pciudad As String, pcp As String, plinea_trans As String, pchofer As String, pplacas As String, pno_economico As String, pno_licencia As String, pfecha_actualizacion As String, prfc_responsable As String, pnombre_responsable As String, prepresentante As String, pprocesado_sip As Long, pprogramado_calt As Long, prfc_transportista As String) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleModificar"
          oraCommandDocumentos.Parameters.Add("pniddocumento", pniddocumento)
          oraCommandDocumentos.Parameters.Add("ptipo_maniobra", ptipo_maniobra)
          oraCommandDocumentos.Parameters.Add("pestado", pestado)
          oraCommandDocumentos.Parameters.Add("particulo", particulo)
          oraCommandDocumentos.Parameters.Add("pfecha_solicitud", pfecha_solicitud)
          oraCommandDocumentos.Parameters.Add("ppuerto_destino", ppuerto_destino)
          oraCommandDocumentos.Parameters.Add("ppuerto_descarga", ppuerto_descarga)
          oraCommandDocumentos.Parameters.Add("pbuque", pbuque)
          oraCommandDocumentos.Parameters.Add("ppatente", ppatente)
          oraCommandDocumentos.Parameters.Add("prectificado", prectificado)
          oraCommandDocumentos.Parameters.Add("pfolio_entrada", pfolio_entrada)
          oraCommandDocumentos.Parameters.Add("pfolio_programacion", pfolio_programacion)
          oraCommandDocumentos.Parameters.Add("pfecha_entrada", pfecha_entrada)
          oraCommandDocumentos.Parameters.Add("pfecha_rectificacion", pfecha_rectificacion)
          oraCommandDocumentos.Parameters.Add("pfecha_programacion", pfecha_programacion)
          oraCommandDocumentos.Parameters.Add("pfeta", pfeta)
          oraCommandDocumentos.Parameters.Add("pidrecinto_desde", pidrecinto_desde)
          oraCommandDocumentos.Parameters.Add("pidrecinto_hasta", pidrecinto_hasta)
          oraCommandDocumentos.Parameters.Add("pvid", pvid)
          oraCommandDocumentos.Parameters.Add("pid_mcia", pid_mcia)
          oraCommandDocumentos.Parameters.Add("ppedimento", ppedimento)
          oraCommandDocumentos.Parameters.Add("pregimen", pregimen)
          oraCommandDocumentos.Parameters.Add("pbooking", pbooking)
          oraCommandDocumentos.Parameters.Add("pregistro", pregistro)
          oraCommandDocumentos.Parameters.Add("pconso_desconso", pconso_desconso)
          oraCommandDocumentos.Parameters.Add("pdc_emp_aduanal", pdc_emp_aduanal)
          oraCommandDocumentos.Parameters.Add("pemp_aduanal", pemp_aduanal)
          oraCommandDocumentos.Parameters.Add("pcliente", pcliente)
          oraCommandDocumentos.Parameters.Add("prfc", prfc)
          oraCommandDocumentos.Parameters.Add("pdireccion", pdireccion)
          oraCommandDocumentos.Parameters.Add("pciudad", pciudad)
          oraCommandDocumentos.Parameters.Add("pcp", pcp)
          oraCommandDocumentos.Parameters.Add("plinea_trans", plinea_trans)
          oraCommandDocumentos.Parameters.Add("pchofer", pchofer)
          oraCommandDocumentos.Parameters.Add("pplacas", pplacas)
          oraCommandDocumentos.Parameters.Add("pno_economico", pno_economico)
          oraCommandDocumentos.Parameters.Add("pno_licencia", pno_licencia)
          oraCommandDocumentos.Parameters.Add("pfecha_actualizacion", pfecha_actualizacion)
          oraCommandDocumentos.Parameters.Add("prfc_responsable", prfc_responsable)
          oraCommandDocumentos.Parameters.Add("pnombre_responsable", pnombre_responsable)
          oraCommandDocumentos.Parameters.Add("prepresentante", prepresentante)
          oraCommandDocumentos.Parameters.Add("pprocesado_sip", pprocesado_sip)
          oraCommandDocumentos.Parameters.Add("pprogramado_calt", pprogramado_calt)
          oraCommandDocumentos.Parameters.Add("prfc_transportista", prfc_transportista)

                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
    ''' <summary>
    ''' Funcion para generar un combo de la tabla SolMultiple
    ''' </summary>
    ''' <param name="pNombre">nombre a buscar en la tabla</param>
    ''' <returns>DataTable</returns>
    ''' <remarks>si el nombre es "" retornara todos los registros</remarks>
   Public Function SolMultiple_Combo(pNombre As String) As DataTable
        Dim dtResultado As New DataTable("SolMultipleCombo")
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleCombo"
                    oraCommandDocumentos.Parameters.Add("pNombre", pNombre)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("pCursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output

                    Dim oraDataAdapter As New OracleDataAdapter(oraCommandDocumentos)
                    oraDataAdapter.Fill(dtResultado)
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return dtResultado
    End Function
  
    ''' <summary>
    ''' Funcion para generar la integracion del documento de la tabla SolMultiple
    ''' </summary>
    ''' <param name="pNidDocumento">numero del documento</param>
    ''' <returns>Byte</returns>
    ''' <remarks></remarks>
   Public Function SolMultiple_Integracion(pNidDocumento As Long) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleIntegracion"
                    oraCommandDocumentos.Parameters.Add("pNidDocumento", pNidDocumento)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output
                    oraCommandDocumentos.Parameters.Add("pMensaje", Oracle.DataAccess.Client.OracleDbType.Varchar2, 200).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    mensaje = oraCommandDocumentos.Parameters("pMensaje").Value.ToString()
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
   Public Function SolMultiple_Borrar(pnid As Long) As Byte
        Dim pTransaccion As Byte = 0
        Dim mensaje As String = String.Empty
        Try
            Using oraConnection As New Oracle.DataAccess.Client.OracleConnection(ConfigurationManager.ConnectionStrings("EDIV2DESOraClient").ConnectionString)
                Using oraCommandDocumentos As New Oracle.DataAccess.Client.OracleCommand()
                    oraCommandDocumentos.Connection = oraConnection
                    oraCommandDocumentos.CommandTimeout = consTimeOut
                    oraCommandDocumentos.CommandType = CommandType.StoredProcedure
                    oraCommandDocumentos.CommandText = "EDIV2.?NomPaquete.SolMultipleBorrar"
                    oraCommandDocumentos.Parameters.Add("pnid", pnid)
                    oraCommandDocumentos.Parameters.Add("pTransaccion", Oracle.DataAccess.Client.OracleDbType.Byte).Direction = ParameterDirection.Output

                    oraConnection.Open()
                    oraCommandDocumentos.ExecuteNonQuery()
                    pTransaccion = CByte(oraCommandDocumentos.Parameters("pTransaccion").Value.ToString())
                    oraConnection.Close()
                End Using
            End Using
        Catch ex As Exception
            Throw ex
        End Try
        Return pTransaccion
    End Function
  
  
End Class
